/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.workflow.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.hibernate.annotations.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author wzp
* @date 2020-10-28
**/
@Entity
@Data
@Table(name="ACT_RE_MODEL")
public class ActReModel implements Serializable {

    @Id
    @Column(name = "ID_")
    @ApiModelProperty(value = "主键")
    private String id;

    @Column(name = "REV_")
    @ApiModelProperty(value = "乐观锁")
    private Integer rev;

    @Column(name = "NAME_")
    @ApiModelProperty(value = "名称")
    private String name;

    @Column(name = "KEY_")
    @ApiModelProperty(value = "模型的关键字")
    private String key;

    @Column(name = "CATEGORY_")
    @ApiModelProperty(value = "分类")
    private String category;

    @Transient
    @ApiModelProperty(value = "分类名称")
    private String categoryName;

    @Column(name = "CREATE_TIME_")
    @CreationTimestamp
    @ApiModelProperty(value = "创建时间")
    private Timestamp createTime;

    @Column(name = "LAST_UPDATE_TIME_")
    @UpdateTimestamp
    @ApiModelProperty(value = "最新修改时间")
    private Timestamp lastUpdateTime;

    @Column(name = "VERSION_")
    @ApiModelProperty(value = "版本")
    private Integer version;

    @Column(name = "META_INFO_")
    @ApiModelProperty(value = "以json格式保存流程定义的信息")
    private String metaInfo;

    @Column(name = "DEPLOYMENT_ID_")
    @ApiModelProperty(value = "部署ID")
    private String deploymentId;

    @Column(name = "EDITOR_SOURCE_VALUE_ID_")
    @ApiModelProperty(value = "编辑源值ID")
    private String editorSourceValueId;

    @Column(name = "EDITOR_SOURCE_EXTRA_VALUE_ID_")
    @ApiModelProperty(value = "编辑源额外值ID")
    private String editorSourceExtraValueId;

    @Column(name = "TENANT_ID_")
    @ApiModelProperty(value = "租户")
    private String tenantId;

    public void copy(ActReModel source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}